<template>
	<view>
		<view class="head">
			<image src="../../static/images/arrow_left.png" mode="" @click="goSite"></image>
			<view class="">新增客户分类</view>
			<view class="f32" @click="AddSeave">保存</view>
		</view>
		<view class="heads">
			<view class="box-l">客户分类</view>
			<view class="box-r"><input type="text" v-model="customerName" placeholder="请输入客户分类名称" /></view>
		</view>
		<view class="box" @tap="$open('../order/discount')">
			<view class="box-l">下单折扣</view>
			<view class="box-r">
				{{ msg }}
				<image src="../../static/images/arrow_right.png" mode=""></image>
			</view>
		</view>
		<button type="primary" @tap="$open('AddtheClassification')">添加分类包含的客户</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			customerName: '',
			zhe: '',
			msg: ''
		};
	},
	onLoad(e) {
		this.zhe = e.id;
		if (this.zhe == '00') {
			this.zhe = '0';
			this.msg = '无折扣';
		} else {
			this.msg = `${this.zhe}折`;
		}
	},
	methods: {
		AddSeave() {
			this.$ajax('api/v1.customer/addRank', {
				rank_name: this.customerName,
				rank_discount: this.zhe
			})
				.then(res => {
					uni.navigateTo({
						url: 'AddtheClassification'
					});
				})
				.catch(res => {
					console.log(Error);
				});
		},
		goSite() {
			uni.navigateTo({
				url: '../clientservice/site'
			});
		},
	
	}
};
</script>

<style lang="scss">
page {
	background-color: #f7f4f8;
}
.head {
	height: 88rpx;
	line-height: 88rpx;
	background-color: #249af6;
	color: #ffffff;
	display: flex;
	justify-content: space-between;
	padding: 0 30rpx;
	font-size: 36rpx;
	font-family: PingFang SC;
	font-weight: 500;
	margin-bottom: 20rpx;
	image {
		width: 22rpx;
		height: 39rpx;
		margin-top: 25rpx;
	}
}
.box {
	height: 110rpx;
	line-height: 110rpx;
	background-color: #ffffff;
	margin-top: 30rpx;
	display: flex;
	justify-content: space-between;
	padding: 0 30rpx;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	image {
		width: 18rpx;
		height: 33rpx;
		vertical-align: middle;
		margin-left: 20rpx;
	}
	.box-r {
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #249af6;
	}
}
.heads {
	height: 110rpx;
	line-height: 110rpx;
	background-color: #ffffff;
	// margin-top: 30rpx;
	display: flex;
	justify-content: space-between;
	padding: 0 30rpx;
	font-size: 32rpx;
	font-family: PingFang SC;
	font-weight: 500;
	position: relative;
	border-bottom: 2rpx solid #eeeeee;
	image {
		width: 18rpx;
		height: 33rpx;
		vertical-align: middle;
		margin-left: 20rpx;
	}
	.box-r {
		.box-l {
			position: absolute;
			left: 0;
		}
		input {
			width: 100%;
			text-align: right;
			height: 100%;
			overflow: hidden;
			padding-left: 100rpx;
			box-sizing: border-box;
		}
		.bx {
			position: absolute;
			right: 100rpx;
		}
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: rgba(102, 102, 102, 1);
	}
}
button {
	position: fixed;
	width: 100%;
	bottom: 0;
}
</style>
